﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Drawing;
using Website.Logger;
using DAL;
using BOL;
using System.Web.Script.Services;
using System.Web.Services;
using WebLib;
using UtilityExtensions;
using System.Globalization;

namespace UILGestion.VentaAdmin.DocumentoVenta
{
    public partial class PendienteFacturacionPanelForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {

           
            //if (!IsPostBack)
            //{
            //    idObra.Value = (string)Request.QueryString["idObra"];
            //    idmotivo.Value = (string)Request.QueryString["idMotivo"];

            //    menuObraCtrl1.loadMenu(int.Parse(idObra.Value), Request.AppRelativeCurrentExecutionFilePath);
            //    FormatForm();
            //}
            }
            catch (SqlException sqlex)
            {
                WebServerSideSqlError.Log(sqlex);
                ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
                 "uniqueKey" + DateTime.Now, "alert('" + sqlex.Message.Replace("'", "") + "');", true);


            }
            catch (Exception ex)
            {
                WebServerSideError.Log(ex);
                ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
                 "uniqueKey" + DateTime.Now, "alert('" + ex.Message.Replace("'", "") + "');", true);

            }
        }
        //private void FormatForm()
        //{
        //    //--------------------
        //    int idEmpleadoEmisor = int.Parse(System.Web.HttpContext.Current.Session["idEmpleado"].ToString());
        //    bool acceso = new DAL.FormularioAcceso().VerificarAcceso(DbUtil.Db,
        //        idEmpleadoEmisor,
        //        5, //Nota Ingreso
        //        int.Parse(idObra.Value),
        //        2); //Crear
        //    //------------------------- 
        //    pnlMain.Visible = true;
        //}

     
        //protected void siguienteButton_Click(object sender, System.EventArgs e)
        //{
        //    try
        //    {
        //        // Create a List to hold the EmployeeID values to delete
        //        List<Int32> idLista = new List<Int32>();
        //        int idProveedor = 0;
        //        // Iterate through the Employees.Rows property
        //        foreach (ListViewDataItem row in OrdenCompraRecepGrid1.ListView.Items)
        //        {

                   
        //            CheckBox cb = (CheckBox)(row.FindControl("chkEmployeeSelector"));
        //            if (cb != null && cb.Checked)
        //            {
        //                //solo del mismo proveedor


        //                int idOrdenCompra = (int)OrdenCompraRecepGrid1.ListView.DataKeys[row.DisplayIndex][0];
        //                int idProveedorcel = (int)OrdenCompraRecepGrid1.ListView.DataKeys[row.DisplayIndex][1];
        //                if (idProveedor == 0)
        //                {
        //                    idProveedor = idProveedorcel;
        //                }
                        
        //                if (idProveedorcel==idProveedor)
        //                    idLista.Add(idOrdenCompra);
                        

        //            }
        //        }
        //        if (idProveedor != 0)
        //        {
        //            int id = Parametros.GenerarID();
        //            Session[id.ToString()] = idLista;

        //            Response.Redirect("../ObraAdmin/NotaIngresoInsertForm.aspx?idObra=" + idObra.Value + "&type=A&idMotivo=" + idmotivo.Value + "&idOCcol=" + id.ToString());
        //        }

        //    }
        //    catch (SqlException sqlex)
        //    {
        //        WebServerSideSqlError.Log(sqlex);
        //        ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
        //         "uniqueKey" + DateTime.Now, "alert('" + sqlex.Message.Replace("'", "") + "');", true);


        //    }
        //    catch (Exception ex)
        //    {
        //        WebServerSideError.Log(ex);
        //        ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
        //         "uniqueKey" + DateTime.Now, "alert('" + ex.Message.Replace("'", "") + "');", true);

        //    }



        //}
    }
}